#ifndef CONFIG_H
#define CONFIG_H

#include "./Common/Logger.hpp"
// #include "./Common/usermanagement.h"
#include "./Common/othertablemanagement.h"
#include "./ChildWidget/widget_doctor.h"
#include "./ChildWidget/widget_patient.h"
#include "./ChildWidget/chatwidget.h"
#include "./ChildWidget/healthassessmentclient.h"
#include <QObject>
#include <memory>
#include <QMessageBox>
#include <QJsonObject>
#include <QJsonDocument>
#include <QVariantMap>
#include <QDateTime>
#include <QThread>
#include <QBarSet>
#include <QValueAxis>
#include <QTcpServer>
#include <QTcpSocket>

#define CQS const QString

CQS g_host = "192.168.0.9";
CQS g_user = "user1";
CQS g_passwd = "123456";
CQS g_database = "imm_system";
CQS g_doctor_tb = "doctor_tb";
CQS g_paitent_tb = "paitent_tb";

class Config : public QObject
{
    Q_OBJECT
private:
    enum MessageBoxStandard {
        Ok,
        Warning,
        Error,
        Unknown
    };

    static MessageBoxStandard getStandardFromString(const QString& standard) {
        if (standard == "ok") return Ok;
        if (standard == "warning") return Warning;
        if (standard == "error") return Error;
        return Unknown;
    }
public:
    static QString getCurrentTime()
    {
        return QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss");
    }

    static void popMessageBox(const QString& title, const QString& content, const QString& standard) {
        QMessageBox mess;
        mess.setWindowTitle(title); // 设置标题
        mess.setText(content);       // 设置内容

        // 使用 switch 语句
        switch (getStandardFromString(standard)) {
            case Ok:
                mess.setIcon(QMessageBox::Information);
                mess.setStandardButtons(QMessageBox::Ok);
                break;
            case Warning:
                mess.setIcon(QMessageBox::Warning);
                mess.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
                break;
            case Error:
                mess.setIcon(QMessageBox::Critical);
                mess.setStandardButtons(QMessageBox::Ok);
                break;
            default:
                mess.setIcon(QMessageBox::Information);
                mess.setStandardButtons(QMessageBox::Ok);
                break;
        }

        mess.exec(); // 显示消息框
    }
};




#endif
